package com.konsung.ksdc.manager.comment;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.konsung.ksdc.R;
import com.konsung.ksdc.bean.CommentInfoBean;
import com.konsung.ksdc.manager.appmain.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/5/19 0019.
 */
public class ProductAllCommentActivity extends BaseActivity {
    List<CommentInfoBean> commentInfoBeanList = new ArrayList<>();
    @Bind(R.id.rl_back)
    RelativeLayout rlBack;
    @Bind(R.id.tab_tv_title)
    TextView tabTvTitle;
    @Bind(R.id.tv_save)
    TextView tvSave;
    @Bind(R.id.iv_counsel)
    ImageView ivCounsel;
    @Bind(R.id.rl_title_container)
    RelativeLayout rlTitleContainer;
    @Bind(R.id.lv_comment)
    ListView lvComment;

    public static final String COMMENT_DATA = "comment_data";

    @Override
    protected String activityDesc() {
        return getString(R.string.page_comment_detail);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_comment_detail);
        ButterKnife.bind(this);

        initData();
        initView();
    }

    /**
     * init view
     */
    private void initView() {
        tabTvTitle.setText(R.string.title_comment_detail);
        rlBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        ivCounsel.setVisibility(View.GONE);
    }

    /**
     * init data
     */
    private void initData() {

//        CommentInfoBean bean = new CommentInfoBean("张三13010102020", "很好用," +
//                "爸妈很喜欢", "2016-5-05", "KS-5 5升普通型");
//        for (int i = 0; i < 5; i++) {
//            commentInfoBeanList.add(bean);
//        }
        commentInfoBeanList = getIntent()
                .getParcelableArrayListExtra(COMMENT_DATA);

        lvComment.setAdapter(new  ProductCommentAdapter(commentInfoBeanList));

    }
}
